#ifndef CCANVAS_H
#define CCANVAS_H

#include <wx/scrolwin.h>
#include <wx/dcclient.h>
#include "CSlideRule.h"
#define RULE_LEFT 10
#define TICK_LEFT 30
#define MAIN_RULE_FRAME_TOP 150
#define UPPER_FRAME_HEIGHT 80
#define AUX_HEIGHT 140
#define DOWN_FRAME_HEIGHT 80
#define MAX_TICK_INTERVAL 4
#define MAX_TICK_DENSITY 50
#define TICK_LENGTH1 60
#define TICK_LENGTH2 40
#define TICK_LENGTH3 30
#define TICK_LENGTH4 20
#define TICK_LENGTH5 15
#define TICK_LENGTH6 10
#define TICK_LENGTH7 7
#define TICK_FONT_SIZE 10
#define VERNIER_RADIUS 20
#define EQUATION_FONT_SIZE 40

class CCanvas : public wxScrolledWindow
{
    public:
        CCanvas(wxWindow *lpParentFrame);
        ~CCanvas();

    protected:
        void OnSize(wxSizeEvent &event);
        void OnPaint(wxPaintEvent &event);
        void OnLeftButtonDown(wxMouseEvent &event);
        void OnMouseDrag(wxMouseEvent &event);
        void OnLeftButtonUp(wxMouseEvent &event);
        void OnKeyUp(wxKeyEvent &event);
        CSlideRule slide_rule;
        unsigned int m_nFrameWidth, m_nAuxRuleTop, m_nAuxRuleBottom, m_nEntireHeight, m_nMainUpperTickMark, m_nMainDownTickMark, m_nAuxTextMid;
        int *m_lpiTicks1, *m_lpiTicks2, *m_lpiTicks3, *m_lpiTicks4, *m_lpiTicks5, m_iAuxPos, m_iVernier;
        int m_iSelect;
        wxCoord m_wxcX, m_wxcY;

    private:
        void DrawMainRuleFrame(wxPaintDC &dc);
        void DrawAuxRuleFrame(wxPaintDC &dc);
        void DrawMainRuleTicks(wxPaintDC &dc);
        void DrawAuxRuleTicks(wxPaintDC &dc);
        void DrawMainRuleTickMarks(wxPaintDC &dc);
        void DrawAuxRuleTickMarks(wxPaintDC &dc);
        void DrawEquation(wxPaintDC &dc);
        DECLARE_EVENT_TABLE()
};

#endif // CCANVAS_H
